package com.aimaoblog.web.controller;

import com.aimaoblog.constant.ServerResponse;
import com.aimaoblog.web.service.FileUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author PuaChen
 * @Create 2018-07-02 18:03
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private FileUploadService fileUploadService;

    @PostMapping("/upload")
    public ServerResponse upload(MultipartFile file, String prefix) {
        return fileUploadService.upload(file, null, prefix);
    }

}
